//
//  UIView+MyFrame.m
//  GameSky
//
//  Created by lanou on 16/1/11.
//  Copyright © 2016年 NiRongfei. All rights reserved.
//

#import "UIView+MyFrame.h"

@implementation UIView (MyFrame)
// 左边界
- (void)setLeft:(CGFloat)newLeft {
    CGRect newFrame = self.frame;
    newFrame.origin.x = newLeft;
    self.frame = newFrame;
}
- (CGFloat)left {
    return self.frame.origin.x;
}
// 右边界
- (void)setRight:(CGFloat)newRight {
    CGRect newFrame = self.frame;
    newFrame.origin.x = newRight - newFrame.size.width;
    self.frame = newFrame;
}
- (CGFloat)right {
    return self.frame.origin.x + self.frame.size.width;
}
// 上边界
- (void)setTop:(CGFloat)newTop {
    CGRect newFrame = self.frame;
    newFrame.origin.y = newTop;
    self.frame = newFrame;
}
- (CGFloat)top{
    return self.frame.origin.y;
}
// 下边界
- (void)setBottom:(CGFloat)newBottom {
    CGRect newFrame = self.frame;
    newFrame.origin.y = newBottom - newFrame.size.height;
    self.frame = newFrame;
}
- (CGFloat)bottom {
    return self.frame.origin.y + self.frame.size.height;
}
// 宽
- (void)setWidth:(CGFloat)newWidth {
    CGRect newFrame = self.frame;
    newFrame.size.width = newWidth;
    self.frame = newFrame;
}
- (CGFloat)width {
    return self.frame.size.width;
}
// 高
- (void)setHeight:(CGFloat)newHeight {
    CGRect newFrame = self.frame;
    newFrame.size.height = newHeight;
    self.frame = newFrame;
}
- (CGFloat)height {
    return self.frame.size.height;
}

@end
